var t, e = require("../../../utils/storage"), i = (t = e) && t.__esModule ? t : {
    default: t
};

Component({
    options: {
        multipleSlots: !0
    },
    properties: {
        placeholder: {
            type: Boolean,
            value: !1
        },
        bgColor: {
            type: String,
            value: "transparent",
            observer: "_showChange"
        },
        textColor: {
            type: String,
            value: "rgba(0, 0, 0, 1)",
            observer: "_showChange"
        },
        title: {
            type: String,
            value: ""
        },
        fixed: {
            type: Boolean,
            value: !1
        },
        boxShadow: Boolean
    },
    data: {
        showNav: !1,
        opacityDiff: 0,
        pagesLength: 0
    },
    created: function() {
        this.getSystemInfo();
    },
    attached: function() {
        this.setStyle();
        var t = getCurrentPages().length;
        this.setData({
            pagesLength: t
        });
    },
    pageLifetimes: {
        show: function() {
            getApp().globalSystemInfo.ios && (this.getSystemInfo(), this.setStyle());
        }
    },
    methods: {
        setStyle: function() {
            var t = (h = getApp().globalSystemInfo).statusBarHeight, e = h.navBarHeight, o = h.capsulePosition, a = h.navBarExtendHeight, n = h.ios, s = h.windowWidth, g = (l = this.data).title, r = l.bgColor, h = l.color, l = s - o.right;
            s -= o.left;
            i.default.setItem("navHeight", e), t = [ "color: " + h, "background: " + r, "height:" + (e + a) + "px", "padding-top:" + t + "px", "padding-right:" + s + "px", "padding-bottom:" + a + "px" ].join(";"), 
            s = [], s = (g ? [ "width:" + o.width + "px", "margin-left:" + l + "px" ] : [ "width:auto", "margin-left:" + l + "px" ]).join(";"), 
            this.setData({
                navigationbarinnerStyle: t,
                navBarLeft: s,
                navBarHeight: e,
                capsulePosition: o,
                navBarExtendHeight: a,
                ios: n
            });
        },
        _showChange: function(t) {
            this.setStyle();
        },
        getSystemInfo: function() {
            var t = getApp(), e = wx.getSystemInfoSync(), i = !!(e.system.toLowerCase().search("ios") + 1), o = void 0;
            if (t.globalSystemInfo && !t.globalSystemInfo.ios) return t.globalSystemInfo;
            try {
                if (null === (o = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null)) throw "getMenuButtonBoundingClientRect error";
                if (!(o.width && o.top && o.left && o.height)) throw "getMenuButtonBoundingClientRect error";
            } catch (t) {
                t = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(t);
                var a = "", n = 96;
                "android" === e.platform ? (a = 8, n = 96) : "devtools" === e.platform ? a = i ? 5.5 : 7.5 : (a = 4, 
                n = 88), e.statusBarHeight || (e.statusBarHeight = e.screenHeight - e.windowHeight - 20), 
                o = {
                    bottom: e.statusBarHeight + a + 32,
                    height: 32,
                    left: e.windowWidth - n - 10,
                    right: e.windowWidth - 10,
                    top: e.statusBarHeight + a,
                    width: n
                };
            }
            return a = "", e.statusBarHeight ? (n = o.top - e.statusBarHeight, a = e.statusBarHeight + 2 * n + o.height, 
            e.navBarExtendHeight = i ? 4 : 0) : (e.statusBarHeight = e.screenHeight - e.windowHeight - 20, 
            a = 2 * (o.top - e.statusBarHeight) + o.height, e.statusBarHeight = 0, e.navBarExtendHeight = 0), 
            e.navBarHeight = a, e.capsulePosition = o, e.ios = i, t.globalSystemInfo = e;
        }
    }
});